package com.ruibang.glass.etl.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * <p>
 * 
 * </p>
 *
 * @author Auto-generator
 * @since 2024-04-19
 */

@ApiModel(value ="")
@TableName("bc_station_xb_detail")
@Data
public class BcStationXbDetail {

    @TableId(value = "_id")
    private String id;
    @TableField("GlassID")
    private String GlassID;
    @TableField("XBJQR_GlassID")
    private String xbjqrGlassid;
    @TableField("XB_GlassID_OUT")
    private String xbGlassidOut;
    @TableField("XBZAXJ_GlassID")
    private String xbzaxjGlassid;
    @TableField("XB_GlassID_IN")
    private String xbGlassidIn;
    @TableField("XB_operation_mode")
    private String xbOperationMode;
    @TableField("XB_equipment_status")
    private String xbEquipmentStatus;
    private String stationProductionTime;
    @TableField("XBJQR_equipment_status")
    private String xbjqrEquipmentStatus;
    private String stationStartTime;
    private String xbSpeed;
    @TableField("XBJQR_operation_mode")
    private String xbjqrOperationMode;
    private String xbXbjqrQbwDown;
    private String param;
    private String xbXbjqrQbwForward;
    private String stationCompleteTime;
    private String xbXbjqrQbwLeft;
    private String xbXbjqrQbwSsz;
    private String xbXbjqrQbwUp;
    private String xbXbjqrXbwForward;
    private String xbXbjqrXbwSsz;
    private String xbXbjqrXbwLeft;
    private String xbXbjqrXbwDown;
    private String xbXbjqrQbwToleft;
    private String xbXbjqrXbwUp;
    private String xbXbjqrSbwLeft;
    private String xbXbjqrXbwToleft;
    private String xbXbjqrSbwDown;
    private String xbXbjqrSbwForward;
    private String xbXbjqrSbwUp;
    private String xbXbjqrSbwSsz;
    private String xbXbjqrSbwToleft;
    private String xbXbjqrQzwDown;
    private String xbXbjqrQzwLeft;
    private String xbXbjqrQzwForward;
    private String xbXbjqrQzwSsz;
    private String xbXbjqrQzwUp;
    @TableField("TR_broken")
    private String trBroken;
    private String xbXbjqrQzwToleft;
    @TableField("TA_broken")
    private String taBroken;
    @TableField("XBJQR_xb")
    private String xbjqrXb;
    @TableField("TA_state")
    private String taState;
    @TableField("TR_state")
    private String trState;
    private String order;
    private String unbind;
    @TableField("XB_Lost_board_count")
    private String xbLostBoardCount;
    @TableField("XBJQR_sblx")
    private String xbjqrSblx;
    private String xbZkylXz1;
    private String xbZkylXz2;
    private String xbZkylXz3;
    private String xbZkylXz4;
    private String xbZkylGlass1;
    private String xbZkylGlass3;
    private String xbZkylGlass5;
    private String xbZkylGlass2;
    private String xbZkylGlass7;
    private String xbZkylGlass4;
    private String xbZkylGlass8;
    private String xbZkylGlass10;
    private String xbZkylGlass12;
    private String xbZkylGlass11;
    private String xbZkylGlass9;
    private String xbZkylGlass6;
    private String dgjqrReal;
    private String dgjqrTr;
    private String dgjqrQb;
    private String dgjqrAframe;
    private String rackId;
    private String rackParam;
    private String rackTime;
    private String rackState;
    @TableField("Aframe_change_start")
    private String aframeChangeStart;
    @TableField("Aframe_change_over")
    private String aframeChangeOver;
    private String aframeBroken;
    private String xbBljg;
    private String productionLineCode;
    private String stationId;
    private String tag;
    private String glassId;
    private String tagOut;
    private String stationStartTimeOrg;
    private String stationCompleteTimeOrg;
    private String station;
    private String table;
    private String dataType;
    private String createTime;
    @TableField("tagText")
    private String tagText;
    public void setCreateTime(String createTime){

        this.createTime = createTime;
    }

    public String getCreateTime(){
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        if(StringUtils.isNotBlank(createTime) && createTime.matches("\\d+")){
            Instant instant = Instant.ofEpochMilli(Long.parseLong(createTime));
            ZoneId zone = ZoneId.systemDefault();
            return LocalDateTime.ofInstant(instant, zone).format(formatter);
        }
        return LocalDateTime.now().format(formatter);
    }
}
